package fingerGussingGame2;
/**
 * 剪刀石头布枚举
 */
public enum Option
{
	SCISSORS(1,"剪刀"),
	ROCK(2,"石头"),
	PAPER(3,"布");
	private final int value;
	private final String nameString;
	Option(int value,String nameString)
	{
		this.value=value;
		this.nameString=nameString;
	}
	public int getValue()
	{
		return value;
	}
	/**
	 * 0平局，-1输，1赢
	 * @param a
	 * @param b
	 * @return
	 */
	public static int isWon(Option a,Option b)
	{
		if((a.value-b.value)==0)
		{
			//System.out.println("平局");
			return 0;
		}else if(a.value-b.value==1||a.value-b.value==-2) 
		{
			//System.out.println("你赢了");
			return 1;
		}else {
			//System.out.println("你输了");
			return -1;
		}
	}
	public String getNameString()
	{
		return nameString;
	}
}
